package com.example.dao;

import com.example.entiy.Book;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.Mapping;

import java.util.List;


@Mapper
public interface BookDao {
    // 查询
    @Select("select * from tbl_book where id = #{id}")
    public Book selectBookById(int id);
    // 添加
    @Select("insert into tbl_book values(#{id},#{name},#{author},#{price},#{publish})")
    public int saveBook(Book book);
    // 修改
    @Select("update tbl_book set name = #{name},author = #{author},price = #{price},publish = #{publish} where id = #{id}")
    public int updateBook(Book book);
    // 删除
    @Select("delete from tbl_book where id = #{id}")
    public int deleteBook(int id);
    // 查询全部
    @Select("select * from tbl_book")
    List<Book> selectBookList();



}
